home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Amiga-E / E_v3.2a / Src / Gfx / Mandel.e < prev    next >
Text File  |  1992-09-02  |  605b  |  25 lines

  1. -> mini fractal
  2.  
  3. CONST CALCW=200,HEIGHT=100, DEPTH=25
  4.  
  5. PROC main()
  6.   DEF w,xmax,ymax,x,y,xr,width=3.5,height=2.8,left,top
  7.   IF w:=OpenW(20,11,240,130,$200,$E,'MiniFrac!',NIL,1,NIL)
  8.     top:=!0.0-3.2; left:=!0.0-2.0; xmax:=CALCW!; ymax:=HEIGHT-1!
  9.     FOR x:=0 TO CALCW-1
  10.       xr:=x!/xmax*width+left
  11.       FOR y:=0 TO HEIGHT-1 DO Plot(x+20,y+20,calc(xr,y!/ymax*height+top))
  12.     ENDFOR
  13.     WaitIMessage(w)
  14.     CloseW(w)
  15.   ENDIF
  16. ENDPROC
  17.  
  18. PROC calc(x,y)
  19.   DEF xtemp,it=0,xc,yc
  20.   xc:=x; yc:=y
  21.   WHILE (it++<DEPTH) AND (!x*x+y*y<16.0)
  22.     xtemp:=x; x:=!x*x-(!y*y)+xc; y:=!xtemp+xtemp*y+yc
  23.   ENDWHILE
  24. ENDPROC it
  25.